package com.usooft.metaTalent.db.system;

import com.usooft.framework.core.query.Page;
import com.usooft.framework.web.auth.RequiresPermission;
import com.usooft.metaTalent.core.system.service.RoleService;
import com.usooft.metaTalent.core.system.wrapper.RoleWrapper;
import com.usooft.metaTalent.db.system.form.RoleListForm;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system/role")
@RequiredArgsConstructor
public class RoleController {
    private final RoleService roleService;

    @GetMapping("/list")
    @RequiresPermission(
            value = "/system/role/list",
            description = "角色/查询"
    )
    public ResponseEntity<?> list(RoleListForm form) {
        Page<RoleWrapper> page = roleService.page(form.buildQuery());
        return ResponseEntity.ok(page);
    }
}
